/**
 * 
 */
package com.zhaokuo.dao;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;

import com.zhaokuo.cache.Cache;
import com.zhaokuo.cache.FlushCacheEvent;
import com.zhaokuo.cache.IvpFlushCacheEvent;
import com.zhaokuo.config.AbstractDao;
import com.zhaokuo.model.Model;

/**
 * @author zk 2012-3-19
 * 
 */
public abstract class MasterAbstractDao<T extends Model, PK extends Serializable>
		extends AbstractDao<T, PK> implements MasterDao<T, PK> {

	private SqlSession masterSqlSession;

	private SqlSessionFactory masterSqlSessionFactory;

	@Resource(name = "masterSqlSession")
	public void setMasterSqlSessionTemplate(
			SqlSessionTemplate masterSqlSessionTemplate) {
		this.masterSqlSession = masterSqlSessionTemplate;
	}

	@Resource(name = "masterSqlSessionFactory")
	public void setMasterSqlSessionFactory(
			SqlSessionFactory masterSqlSessionFactory) {
		this.masterSqlSessionFactory = masterSqlSessionFactory;
	}

	@Override
	protected SqlSession callMasterSqlsession() {
		return masterSqlSession;
	}

	@Override
	protected SqlSessionFactory callMasterSqlsessionFactory() {
		return masterSqlSessionFactory;
	}

	@Override
	protected void handleList(List list, String statement) {
		// TODO Auto-generated method stub
	}

	@Override
	protected void handleOne(Object obj, String statement) {
		// TODO Auto-generated method stub
	}

	@Override
	protected boolean flushOnUpdate() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	protected Map<String, String> buildFlushCacheMapper() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected FlushCacheEvent createFlushCacheEvent(Object source) {
		return new IvpFlushCacheEvent(source);
	}

	@Override
	@Resource(name = "ivpCache")
	public void setCache(Cache cache) {
		super.setCache(cache);
	}
}
